const mysql = require('mysql');
const pool = mysql.createPool({
    host: '127.0.0.1',
    user: 'root',
    password: 'aaa***1111',
    database: 'xhpx'
});
let db = {};

//获取连接
db.getConnection = function (callback) {
    pool.getConnection(function (err, connection) {
        if (err) {
            callback(null);
            console.log("数据库连接报错：" + err)
            return;
        }
        callback(connection);
    });
};


module.exports = db;